package com.planegame.Obj;

import com.planegame.GameWin;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

//自身飞机
public class PlaneObj extends GameObject{
    @Override
    public void setImg(Image img) {
        super.setImg(img);
    }

    public PlaneObj() {
        super();
    }

    public PlaneObj(Image img, int x, int y, double speed) {
        super(img, x, y, speed);
    }

    public PlaneObj(Image img, int x, int y, int width, int hight, double speed, GameWin frame) {
        super(img, x, y, width, hight, speed, frame);
        //设置飞机跟随鼠标移动
        this.frame.addMouseMotionListener(new MouseAdapter() {
        public void mouseMoved(MouseEvent e){
            PlaneObj.super.x=e.getX()-11;//飞机本身长度一半
            PlaneObj.super.y=e.getY()-16;//宽度一半
        }
        });
    }

    @Override
    public void paintSelf(Graphics gImage) {
        super.paintSelf(gImage);
    }

    @Override
    public Rectangle getRec() {
        return super.getRec();
    }
}
